﻿@model IEnumerable<PerformanceAssessment.Models.EmployeeList>
@{
    ViewBag.Title = "Employees";

    RouteValueDictionary rvd = Request.QueryString.ToRouteValues();
    if (!rvd.Keys.Contains("sortOrder"))
    {
        rvd.Add("sortOrder", null);
    }
}
<h2>
    Employees</h2>
    @if (ViewBag.EmployeeChangedMessage != null)
{
    <p style="color:Red;">
        @ViewBag.EmployeeChangedMessage
    </p>
}
<p>
    @Html.ActionLink("Create New Employee", "Create")
    @using (Html.BeginForm("Index", "Employees", FormMethod.Get))
    {   
        <p>
            Team: @Html.DropDownList("teamString", "All")
            Name: @Html.TextBox("SearchString")
            Active: @Html.CheckBox("activeBool", true)
            <input type="submit" value="Filter" /></p>
    }
</p>
<table>
    <tr>
        <th>
            @{ rvd["sortOrder"] = ViewBag.TeamSortParm; }
            @Html.ActionLink("Team", "Index", rvd)
        </th>
        <th>
            @{ rvd["sortOrder"] = ViewBag.IdSortParm; }
            @Html.ActionLink("Identification", "Index", rvd)
        </th>
        <th>
            @{ rvd["sortOrder"] = ViewBag.NameSortParm; }
            @Html.ActionLink("Name", "Index", rvd)
        </th>
        <th>
            @{ rvd["sortOrder"] = ViewBag.EmailSortParm; }
            @Html.ActionLink("Email", "Index", rvd)
        </th>
        <th>
            @{ rvd["sortOrder"] = ViewBag.StartDateSortParm; }
            @Html.ActionLink("Start Date", "Index", rvd)
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Team)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Ced)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Email)
            </td>
            <td style="text-align: right">
                @Html.DisplayFor(modelItem => item.StartDate)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
                @Html.ActionLink("Details", "Details", new { id = item.ID }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.ID })
            </td>
        </tr>
    }
</table>
